import logging



# 初始化logger对象
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

# 定义格式器
format = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

# 定义处理器
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(format)

# 定义文件处理器
file_handler = logging.FileHandler(filename='api_reslut.log', mode="w", encoding="utf-8")
file_handler.setFormatter(format)

# 将处理器添加到logger对象
logger.addHandler(stream_handler)
logger.addHandler(file_handler)
